package com.xinxin.blockchain.service;

import com.xinxin.blockchain.asset.enums.AssetBusinessTypeEnum;
import com.xinxin.blockchain.dao.IAccountAssetDao;
import com.xinxin.blockchain.model.AccountAsset;

import java.math.BigDecimal;

/**
 * @author ys
 * @date 2021/5/24
 */
public interface IAccountAssetService extends IAccountAssetDao {

    AccountAsset getByType(Long accountId, Integer type);

    AccountAsset forceGetByType(Long accountId, Integer type);

    boolean optimisticLockUpdate(AccountAsset asset);

    AccountAsset createAsset(Long accountId, Integer type);

    AccountAsset getOrCreate(Long accountId, Integer type);

    AccountAsset increase(Long accountId, Integer assetType, BigDecimal amount, AssetBusinessTypeEnum businessType);

    AccountAsset cost(Long accountId, Integer assetType, BigDecimal amount, AssetBusinessTypeEnum businessType);

    AccountAsset frozen(Long accountId, Integer assetType, BigDecimal amount, AssetBusinessTypeEnum businessType);

    AccountAsset unFrozen(Long accountId, Integer assetType, BigDecimal amount, AssetBusinessTypeEnum businessType);

    AccountAsset costFrozen(Long accountId, Integer assetType, BigDecimal amount, AssetBusinessTypeEnum businessType);
}
